﻿<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeBehind="AddActivity.aspx.cs" Inherits="NJL.WebManage.Company.AddActivity" %>

<%@ Import Namespace="Royalsoft.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
          <style type="text/css">
        #enlarge_images
        {
            position: absolute;
            display: none;
            z-index: 2;
            border: 5px solid #f4f4f4;
        }
    </style>
    <title></title>
    <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
    <script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        function textboxSelect() {
            var checkbox = document.getElementsByName("cbxSingle");
            for (var i = 0; i < checkbox.length; i++) {
                checkbox[i].checked = !checkbox[i].checked;
            }
        }
        function checkCheckboxState() {
            var checkbox = document.getElementsByName("cbxSingle");
            var hiddenId = "";
            var count = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked == true) {
                    hiddenId += checkbox[i].value + ",";
                    count++;
                }
            }
            if (count == 0) {
                alert('请选择您要删除的记录')
                return false;
            }
            else {
                if (window.confirm("您确定要删除该记录？")) {
                    hiddenId = hiddenId.substring(0, hiddenId.length - 1);
                    document.getElementById("<%=HSelectId.ClientID %>").value = hiddenId;
                }
                else {
                    return false;
                }
            }
        }
        var check = function () {
            var regInt = /^\d+$/; //整数
            var txtSort = document.getElementById("<%=txtSort.ClientID %>").value;
            if (regInt.exec(txtSort) == null) {
                alert("排序只能输入整数");
                return false;
            }
            var txtName = document.getElementById("txtName").value;
            if ($.trim(txtName) == "") {
                alert("请输入名称");
                return false;
            }
            var txtDesc = document.getElementById("<%=txtDesc.ClientID %>").value;
            if (txtDesc.length > 500) {
                alert("简介长度不要超过500个汉字");
                return false;
            }
            //页面描述
            var txtDescription = document.getElementById("<%=txtDescription.ClientID %>").value;
            if (txtDescription.length > 200) {
                alert("页面描述内容数超过200个字符请重新输入");
                return false;
            }
        }                      
      
    </script>
    <style type="text/css">
        .style1
        {
            height: 15px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server" enctype="multipart/form-data">
    <div class="main_content fr">
        <div class="gray_bd">
            <div class="table_title">
                <span style="width: 95%; display: block; float: left">
                    <asp:Literal ID="litCompanyName" runat="server"></asp:Literal>
                    -活动信息</span><span style="display:none"><input id="Button2" type="button" value="返回" onclick="window.location.href='CompanyManage.aspx?typeid=<%=Request.QueryString["typeid"] %>&typeName=<%=Request.QueryString["typeName"] %>&Page=<%=Request["Page"] %>'" /></span>
            </div>
            <div class="pad5px">
                <table cellpadding="0" cellspacing="0" style="width: 100%" align="center">
                     <tr>
                    <td style="width: 120px; text-align: right;">
                        排序：</td>
                    <td>
                        <asp:TextBox ID="txtSort" runat="server" MaxLength="8" Width="50px">0</asp:TextBox>
                    </td>
                    <td>
                        &nbsp;</td>
                </tr>
                    <tr>
                        <td align="right" width="50">
                            名称 ：
                        </td>
                        <td>
                            <asp:TextBox ID="txtName" runat="server" Width="50%" MaxLength="50"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right" width="50">
                            活动简介：</td>
                        <td>
                            <asp:TextBox ID="txtDesc" runat="server" Height="81px" TextMode="MultiLine" 
                                Width="469px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                    <td style="width: 120px; text-align: right;">
                        图片：&nbsp;
                    </td>
                    <td>
                   <asp:FileUpload ID="FileUpload1" runat="server" /> &nbsp;&nbsp;<asp:Button ID="Button1" runat="server" Text="上传" OnClick="btnUpload_Click" Visible="false" /> 请上传600*450尺寸以内的图片
                    </td>
                        
                        <td class="style1">
                            </td>
                    </tr>
                    <tr>
                        <td align="right">
                            内容：
                        </td>
                        <td>
                            <asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="61px" Width="100%"></asp:TextBox>
                            <script type="text/javascript">
                                CKEDITOR.replace('<%=txtContent.ClientID%>',
                            {
                                filebrowserBrowseUrl: '/ckfinder/ckfinder.html', //启用浏览功能
                                filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html?Type=Images',
                                filebrowserFlashBrowseUrl: '/ckfinder/ckfinder.html?Type=Flash',
                                filebrowserUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
                                filebrowserImageUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
                                filebrowserFlashUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
                            }
                            );
                            </script>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                                   <tr>
                    <td style="width: 120px; text-align: right;">
                        页面标题：
                    </td>
                    <td>
                        <asp:TextBox ID="txtTitle" runat="server" Width="100%" MaxLength="50"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td style="width: 120px; text-align: right;">
                        页面关键字：
                    </td>
                    <td>
                        <asp:TextBox ID="txtKeyWords" runat="server" Width="100%" MaxLength="50"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td style="width: 120px; text-align: right;">
                        页面描述：
                    </td>
                    <td>
                        <asp:TextBox ID="txtDescription" runat="server" Height="51px" TextMode="MultiLine"
                            Width="100%"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" OnClientClick="return check()" />
                            &nbsp;<input id="Reset1" type="reset" value="重置" runat="server" />
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
                <hr />
                <div class="border_b_dotted">
                    <table class="tableliststyle" cellspacing="0" rules="all" border="1" id="demo">
                        <tr class="gridheader">
                            <th style="width: 40px;">
                                <input id="cbxAll" type="checkbox" onclick="textboxSelect()" />
                            </th>
                            <th style="width: 40px;">
                                序号
                            </th>
                            <th style="width: 120px;">
                                名称
                            </th>
                            <th style="width: 100px;">
                                简介
                            </th>
                            <th style="width: 80px;">
                            图片
                            </th>
                            <th style="width: 150px;">
                                创建时间
                            </th>
                            <th style="width: 80px;">
                            排序
                            </th>
                            <th style="width: 40px;">
                                发布
                            </th>
                            <th style="width: 40px;">
                                编辑
                            </th>
                            <th style="width: 40px;">
                                删除
                            </th>
                        </tr>
                        <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand"
                            OnItemDataBound="rptUserList_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td align="center">
                                        <input id="<%#Eval("ID") %>" type="checkbox" value="<%#Eval("ID") %>" name="cbxSingle" />
                                    </td>
                                    <td align="center">
                                        <asp:Literal ID="litNum" runat="server"></asp:Literal>
                                    </td>
                                    <td align="left" title="<%#Eval("ACTIVE_NAME") %>">
                                        <%#PageValidate.SqlText(Eval("ACTIVE_NAME").ToString(), 6)%>
                                    </td>
                                    <td align="center" title="<%#Eval("ACTIVE_INTRO") %>">
                                        <%#PageValidate.SqlText(Eval("ACTIVE_INTRO").ToString(), 15)%>
                                    </td>
                                    <td align="center">
                                    
                                        <asp:Image ID="Image1" runat="server" Width="80" Height="50" />
                                    </td>
                                    </td>
                                    <td align="center">
                                        <%#Eval("CREATE_DATE_TIME","{0:yyyy-MM-dd HH:mm:ss}")%>
                                    </td>
                                     <td align="center">
                                        <%#Eval("SORT")%>
                                    </td>
                                    <td align="center">
                                        <asp:ImageButton ID="imgbtn3" runat="server" CommandName="imgbtn3" CommandArgument='<%#Eval("ID") %>' AlternateText='<%#Eval("IS_PUBLISH") %>'/>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbntEdit" runat="server" CommandName="Edit" CommandArgument='<%#Eval("ID") %>'>编辑</asp:LinkButton>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbtnDel" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
                                            OnClientClick="return confirm('您确定要删除该信息吗？')">删除</asp:LinkButton>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div style="text-align: left; margin-top: 5px;">
                        <asp:Button ID="btnDel" runat="server" Text="删除" OnClientClick="return checkCheckboxState()"
                            OnClick="btnDel_Click1" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField ID="HSelectId" runat="server" />
    </form>
              <div id="enlarge_images">
    </div>
    <script type="text/javascript">
        var demo = document.getElementById("demo");
        var gg = demo.getElementsByTagName("img");
        var ei = document.getElementById("enlarge_images");
        for (i = 0; i < gg.length; i++) {
            var ts = gg[i];
            ts.onmousemove = function (event) {
                event = event || window.event;
                ei.style.display = "block";
                ei.innerHTML = '<img src="' + this.src + '" />';
                ei.style.top = document.body.scrollTop + event.clientY + 10 + "px";
                ei.style.left = document.body.scrollLeft + event.clientX + 10 + "px";
            }
            ts.onmouseout = function () {
                ei.innerHTML = "";
                ei.style.display = "none";
            }
            ts.onclick = function () {
                window.open(this.src);
            }
        }
    </script>
</body>
</html>
